import request from "../axios";

/**
 * 退出登录
 * @returns 
 */
export function adminExit() {
    return request({
        method: "GET",
        url: '/user/logout'
    })
}

//商品图片上传
export function UploadFile(data) {
    return request({
        method: "Post",
        url: '/employeeProfile/updateEmployeeImg',
        headers: {
            'Content-Type': 'multipart/form-data'
        },
        data: data,
    })
}

//新增员工档案信息
export function addEmployeeProfile(data) {
    return request({
        method: "Post",
        url: '/employeeProfile/addEmployeeProfile',
        data: data,
    })
}

/**
 * 分页查询档案信息
 * @param {*} page 当前页
 * @param {*} size 每页大小
 * @returns 
 */
export function selectEmployeeProfileByAdmin(page, size) {
    return request({
        method: "POST",
        url: "/employeeProfile/selectEmployeeProfileByAdmin",
        params: {
            page: page,
            size: size
        },
    })
}

/**
 * 分页查询审核中，未通过的档案信息
 * @param {*} page 当前页
 * @param {*} size 每页大小
 * @param {*} type 状态，1为审核中，2为通过，3为未通过
 * @returns 
 */
export function selectEmployeeProfileByState(page, size, type) {
    return request({
        method: "POST",
        url: "/employeeProfile/selectEmployeeProfileByState",
        params: {
            page: page,
            size: size,
            type: type
        },
    })
}

/**
 * 通过id删除档案用户信息
 * @param {*} id 用户id
 * @returns 
 */
export function deleteEmployeeProfileById(id) {
    return request({
        method: "POST",
        url: '/employeeProfile/deleteEmployeeProfileById',
        params: {
            id: id
        }
    })
}

/**
 * 管理修改档案用户信息（或者申请修改）
 * @param {*} data 用户信息
 * @returns 
 */
export function updateEmployeeProfile(data) {
    return request({
        method: "Post",
        url: '/employeeProfile/updateEmployeeProfile',
        data: data,
    })
}

/**
 * 管理员审核档案用户信息
 * @param {*} id 用户id
 * @param {*} state 审核状态
 * @returns 
 */
export function updateEmployeeUpdateStatus(id, state) {
    return request({
        method: "Post",
        url: '/employeeProfile/updateEmployeeUpdateStatus',
        params: {
            id: id,
            state: state
        }
    })
}

/**
 * 通过id查询档案用户信息
 * @param {*} userId 用户id
 * @returns 
 */
export function selectEmployeeProfileById(userId) {
    return request({
        method: "POST",
        url: '/employeeProfile/selectEmployeeProfileById',
        params: {
            userId: userId
        }
    })
}

/**
 * 通过模糊查询档案用户信息
 * @param {*} userId 用户id
 * @returns 
 */
export function selectEmployeeProfileByName(name) {
    return request({
        method: "POST",
        url: '/employeeProfile/selectEmployeeProfileByName',
        params: {
            name: name
        }
    })
}


/**
 * 通过档案审核状态模糊查询档案用户信息
 * @param {*} userId 用户id
 * @returns 
 */
export function selectEmployeeProfileByStateLike(name, ExamineType) {
    return request({
        method: "POST",
        url: '/employeeProfile/selectEmployeeProfileByStateLike',
        params: {
            name: name,
            type: ExamineType
        }
    })
}